package com.xishu.lambda;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.function.Consumer;

@FunctionalInterface
public interface ThrowingConsumer<T> extends Consumer<T> {
    Logger logger = LoggerFactory.getLogger(ThrowingConsumer.class);

    @Override
    default void accept(final T e) {
        try {
            acceptThrow(e);
        } catch (Throwable ex) {
            logger.error("e", ex);
        }
    }

    void acceptThrow(T e) throws Throwable;
}
